/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Core.impl;

import EA_Model.IEC61970.Core.CorePackage;
import EA_Model.IEC61970.Core.Terminal;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Terminal</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Core.impl.TerminalImpl#getConnected <em>Connected</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Core.impl.TerminalImpl#getSequenceNumber <em>Sequence Number</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class TerminalImpl extends IdentifiedObjectImpl implements Terminal {
	/**
	 * The cached value of the '{@link #getConnected() <em>Connected</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getConnected()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Boolean connected;

	/**
	 * The cached value of the '{@link #getSequenceNumber() <em>Sequence Number</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSequenceNumber()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Integer sequenceNumber;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected TerminalImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return CorePackage.Literals.TERMINAL;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean getConnected() {
		if (connected != null && connected.eIsProxy()) {
			InternalEObject oldConnected = (InternalEObject)connected;
			connected = (EA_Model.IEC61970.Domain.Boolean)eResolveProxy(oldConnected);
			if (connected != oldConnected) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.TERMINAL__CONNECTED, oldConnected, connected));
			}
		}
		return connected;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean basicGetConnected() {
		return connected;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setConnected(EA_Model.IEC61970.Domain.Boolean newConnected) {
		EA_Model.IEC61970.Domain.Boolean oldConnected = connected;
		connected = newConnected;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.TERMINAL__CONNECTED, oldConnected, connected));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Integer getSequenceNumber() {
		if (sequenceNumber != null && sequenceNumber.eIsProxy()) {
			InternalEObject oldSequenceNumber = (InternalEObject)sequenceNumber;
			sequenceNumber = (EA_Model.IEC61970.Domain.Integer)eResolveProxy(oldSequenceNumber);
			if (sequenceNumber != oldSequenceNumber) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CorePackage.TERMINAL__SEQUENCE_NUMBER, oldSequenceNumber, sequenceNumber));
			}
		}
		return sequenceNumber;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Integer basicGetSequenceNumber() {
		return sequenceNumber;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSequenceNumber(EA_Model.IEC61970.Domain.Integer newSequenceNumber) {
		EA_Model.IEC61970.Domain.Integer oldSequenceNumber = sequenceNumber;
		sequenceNumber = newSequenceNumber;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CorePackage.TERMINAL__SEQUENCE_NUMBER, oldSequenceNumber, sequenceNumber));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case CorePackage.TERMINAL__CONNECTED:
				if (resolve) return getConnected();
				return basicGetConnected();
			case CorePackage.TERMINAL__SEQUENCE_NUMBER:
				if (resolve) return getSequenceNumber();
				return basicGetSequenceNumber();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case CorePackage.TERMINAL__CONNECTED:
				setConnected((EA_Model.IEC61970.Domain.Boolean)newValue);
				return;
			case CorePackage.TERMINAL__SEQUENCE_NUMBER:
				setSequenceNumber((EA_Model.IEC61970.Domain.Integer)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case CorePackage.TERMINAL__CONNECTED:
				setConnected((EA_Model.IEC61970.Domain.Boolean)null);
				return;
			case CorePackage.TERMINAL__SEQUENCE_NUMBER:
				setSequenceNumber((EA_Model.IEC61970.Domain.Integer)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case CorePackage.TERMINAL__CONNECTED:
				return connected != null;
			case CorePackage.TERMINAL__SEQUENCE_NUMBER:
				return sequenceNumber != null;
		}
		return super.eIsSet(featureID);
	}

} //TerminalImpl
